var jwt = require('jsonwebtoken')
var fs = require('fs')
var path = require('path')


exports.createToken = (username, id) => {
    const private = fs.readFileSync(path.join(__dirname, '../secret/jwt.pem'))
    return jwt.sign({
        id: id,
        username: username
    }, private, {
        expiresIn: '1h',
        algorithm: 'RS256'
    })
}